# include <bits/stdc++.h>
# define MAXN 100023
using namespace std;
inline int gn() {
    int k = 0;
    char c = getchar();
    for(; !isdigit(c); c = getchar());
    for(; isdigit(c); c = getchar()) k = k * 10 + c - '0';
    return k;
}
int n; // num of last
vector <int> la, to[MAXN], gl;
double ans;
void dfs(int fa, int x, int d, double p) {
    for(int i = 0; i < to[x].size(); i++) {
        if(to[x][i] == fa) continue;
        dfs(x, to[x][i], d + 1, p / (to[x].size() - 1));
    }
    if(to[x].size() == 1) {
        ans += d * p;
    }
}
int main() {
    n = gn();
    to[1].push_back(0);
    for(int i = 1; i < n; i++) {
        int x = gn(), y = gn();
        to[x].push_back(y);
        to[y].push_back(x);
    }
    dfs(0, 1, 0, 1);
    printf("%.10lf\n", ans);
    return 0;
}
